package 笔试.腾讯;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
import java.util.stream.Collectors;

/**
 * @author:谢君臣
 * @Date:2021/8/22-20:03
 * @version:1.0
 * @function:
 */
public class Main02 {
    private static long T = 1000000007;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        while (n>0){
            int m = scanner.nextInt();
            int[]arr = new int[m];
            for (int i = 0; i < m; i++) {
                arr[i] = scanner.nextInt();
            }
            Arrays.sort(arr);
            solve(arr);
            n--;
        }
    }
    private static void solve(int[] arr) {
        long count = 0;
        for (int i = arr.length-1; i >=0; i--) {
            count = 2*count+arr[i];
        }
        System.out.println(count%T);
    }
}
